// 模拟上传服务：返回可下载的 blob URL，并提供进度回调
export async function uploadFile(file, onProgress) {
  return new Promise(resolve => {
    const total = 100
    let cur = 0
    const timer = setInterval(() => {
      cur += 10
      onProgress && onProgress(Math.min(cur, total))
      if (cur >= total) {
        clearInterval(timer)
        const url = URL.createObjectURL(file)
        resolve({ 
          url, 
          name: file.name, 
          size: file.size,
          type: file.type 
        })
      }
    }, 120)
  })
}

export default { uploadFile }


